<!DOCTYPE HTML>
<html style="background-color:rgb(249,249,251)">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>addstudentmsg</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../../css/pair.css" />
    <link rel="stylesheet" type="text/css" href="../../css/font-awesome.css" />

</head>

<style media="screen">
</style>

<body>
    <!-- style="background-color:rgb(249,249,251)" -->
    <header class="aui-bar aui-bar-nav" style="background-color:white;position:fixed;z-index:2;height:2.5rem;padding-top:0.8rem">
        <a class="aui-pull-left aui-btn" onclick="api.closeWin()">
            <i style="color:black" class="fa fa-chevron-left" aria-hidden="true"></i>
        </a>
        <div class="aui-title" style="color:black">增加学生信息</div>
        <a class="aui-pull-right">
            <span>
                <img src="../../image/321AC.png" style="padding-top:0.25rem;">
            </span>
        </a>
    </header>

    <div class="aui-content aui-margin-b-15" style="margin-top:0.25rem">
        <ul class="aui-list aui-form-list">
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        姓名:
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" v-model="stu_name">
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        姓名:
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" v-model="stu_name">
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        性别：
                    </div>
                    <div class="aui-list-item-input">
                        <label><input class="aui-radio" type="radio" name="demo1" v-model="stu_man" value="男" checked="">男</label>
                        <label><input class="aui-radio" type="radio" name="demo1" v-model="stu_man" value="女"> 女</label>
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        学院:
                    </div>
                    <div class="aui-list-item-input">
                        <!-- <input type="text" v-model="stu_class"> -->
                        <select v-model="stu_class">
                            <option v-for="item in dept">{{item}}</option>
                        </select>
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        班级:
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" v-model="stu_banji">
                    </div>
                </div>
            </li>
            <!-- <div style="width:100%;height:0.2rem;background-color:#ccc"></div> -->
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        民族:
                    </div>
                    <div class="aui-list-item-input" @click="select()">
                        <input type="text" v-model="stu_nation" readonly>
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        政治面貌:
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" v-model="stu_zzmm">
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        家庭地址:
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" v-model="stu_addr">
                    </div>
                </div>
            </li>
            <!-- <div style="width:100%;height:0.2rem;background-color:#ccc"></div> -->
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        身份证号:
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" v-model="stu_idcard">
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        学号:
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" v-model="stu_sno">
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        qq号:
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" v-model="stu_qqid">
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        宿舍号:
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" v-model="stu_docuid">
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        联系电话:
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" v-model="stu_phone">
                    </div>
                </div>
            </li>
        </ul>
    </div>
    <div class="aui-btn aui-btn-danger aui-btn-block aui-btn-sm" style="width:70%!important;margin-left:15%!important;margin-bottom: 0.75rem"
        @click="sure()">确认增加</div>
</body>

<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/vue1.0.js"></script>
<script type="text/javascript" src="../../script/util.js"></script>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript">
    apiready = function () {
        vm = new Vue({
            el: "body",
            data: {
                student: {},
                stu_name: "",
                stu_man: "",
                stu_addr: "",
                stu_banji: "",
                stu_nation: "",
                stu_docuid: "",
                stu_qqid: "",
                stu_zzmm: "",
                stu_sno: "",
                stu_idcard: "",
                stu_phone: "",
                stu_class: "",
                nation: [],
                dept: []
            },
            methods: {
                cancel: function () {
                    api.openWin({
                        name: 'StudentInformation',
                        url: './StudentInformation.html',
                        pageParam: {
                            name: 'test'
                        }
                    });
                },
                select: function () {
                    var me = this;
                    api.actionSheet({
                        title: '选择民族',
                        cancelTitle: '取消',
                        buttons: me.nation
                    }, function (ret, err) {
                        var index = ret.buttonIndex;
                        if (index == me.nation.length+1) {
                            me.stu_nation = me.nation.itemValue;
                        } else {
                            me.stu_nation = me.nation[index - 1];
                        }
                    });
                },

                sure: function () {
                    var me = this;
                    if (me.stu_idcard.trim() == "") {
                        alert("请输入身份证号")
                    } else {
                        api.ajax({
                            url: serverIp + "/friend/addJieDuiStudent.do",
                            method: 'post',
                            data: {
                                values: {
                                    stu_name: me.stu_name,
                                    stu_sex: me.stu_man,
                                    stu_addr: me.stu_addr,
                                    stu_banji: me.stu_banji,
                                    stu_nation: me.stu_nation,
                                    stu_docuid: me.stu_docuid,
                                    stu_qqid: me.stu_qqid,
                                    stu_zzmm: me.stu_zzmm,
                                    stu_sno: me.stu_sno,
                                    stu_idcard: me.stu_idcard,
                                    stu_phone: me.stu_phone,
                                    stu_class: me.stu_class
                                }
                            }
                        }, function (ret, err) {
                            if (ret) {
                                alert("增加成功");
                                api.closeWin({
                                    reload: true
                                });


                            } else {
                                alert(JSON.stringify(err));
                            }
                        });
                    }

                }
            },
            created: function () {
                var me = this;
                var value = api.pageParam["student"];
                me.student = value;
                $api.get(serverIp + "/friend/nationtypeActivity.do", function (ret) {
                    if (ret) {
                        me.nation = ret.data;
                        api.setPrefs({
                            key: 'nation',
                            value: me.nation
                        });
                    }
                }, 'JSON');
                $api.get(serverIp + "/friend/getdeptActivity.do", function (ret) {
                    if (ret) {
                        me.dept = ret.data;
                    }
                }, 'JSON');
            },
        });
    }
</script>

</html>